{extend name="public/base" /}{block name="style"}
<link href="__LIB__/fileinput/css/fileinput.min.css" rel="stylesheet" /> {/block} {block name="body"}
<div class="content-tabs">
	<ol class="breadcrumb">
		<li>
			<a href="{:url('admin/index/index')}"><i class="fa fa-home"></i></a>
		</li>
		<li>
			<a href="{:url('index')}">素材列表</a>
		</li>
		<li><strong>编辑素材</strong></li>
	</ol>
</div>
<div class="row">
	<div class="col-sm-12">
		<div class="ibox float-e-margins">
			<div class="ibox-title">
				<h5>编辑素材</h5>
			</div>
			<div class="ibox-content">
				<form id="myForm" class="form-horizontal m-t" method="post" action="{:url('update_news')}">
					<div class="form-group">
						<label class="col-sm-3 control-label">素材名：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="name" name="name" value="{$model.name}" placeholder="素材名" class="form-control" />
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<label class="col-sm-3 control-label">图文标题：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="title" name="title" value="{$model.content.title}" placeholder="图文标题" class="form-control" />
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<label class="col-sm-3 control-label">图文简介：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="digest" name="digest" value="{$model.content.digest}" placeholder="图文简介" class="form-control" />
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<label class="col-sm-3 control-label">图文作者：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="author" name="author" value="{$model.content.author}" placeholder="图文作者" class="form-control" />
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<label class="col-sm-3 control-label">图文封面：</label>
						<div class="input-group col-sm-4">
							<input type="hidden" id="thumb" name="thumb" />
							<input id="upload" name="upload" type="file" />
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<label class="col-sm-3 control-label">图文链接：</label>
						<div class="input-group col-sm-4">
							<input type="text" id="content_source_url" value="{$model.content.content_source_url}" name="content_source_url" placeholder="图文链接" class="form-control" />
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<label class="col-sm-3 control-label">图文内容：</label>
						<div class="input-group col-sm-4">
							<textarea id="content" name="content" style="height: 400px;">{$model.content.content}</textarea>
						</div>
					</div>
					<div class="hr-line-dashed"></div>
					<div class="form-group">
						<div class="col-sm-4 col-sm-offset-3">
							<input type="hidden" name="id" value="{$model.id}" />
							<button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;
							<a href="{:url('index')}" class="btn btn-danger"><i class="fa fa-arrow-left"></i> 返回 </a>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
{/block} {block name="script"}
<script src="__LIB__/validate/jquery.validate.min.js"></script>
<script src="__LIB__/validate/messages_zh.min.js"></script>
<script src="__LIB__/validate/add_validate.min.js"></script>
<script src="__LIB__/fileinput/js/fileinput.min.js"></script>
<script src="__LIB__/fileinput/js/locales/zh.js"></script>
<script src="__LIB__/ueditor/ueditor.config.js" type="text/javascript"></script>
<script src="__LIB__/ueditor/ueditor.all.js" type="text/javascript"></script>
<script>
	//顶部导航
	$("#li-bar-news").addClass("active");
	//编辑器
	var ueditor = UE.getEditor('content');
	// 图片上传
	upload_one('{$model.thumb}');
	$(function() {
		$("#myForm").validate({
			rules: {
				name: "required"
			},
			messages: {
				name: ICON.error + "请输入素材名"
			},
			submitHandler: function(form) {
				ajaxForm();
			}
		});
	});
</script>
{/block}